﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Backend/Backend.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<IntroduceCompany.AlbumView>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    AlbumList
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <!-- Begin one column tab content window -->
    <div class="onecolumn">
        <div class="header">
            <span>Danh Sách Album</span>
            <div class="switchbutton">
                <a href="<%= Url.Action("AlbumCreate", "Album") %>" class="button">Thêm mới</a>
            </div>
        </div>
        <br class="clear" />
        <div class="content">
            <div id="tab1_content" class="tab_content">
                <table width="100%">
                    <tr>
                        <td>
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" style="width: 170px;" />
                                    </div>
                                    <div class="details">
                                        <div class="ddl">
                                            <div>
                                                <label>
                                                    Ngôn ngữ:</label><br />
                                                <% using (Html.BeginForm("ChangeLanguage", "Language", FormMethod.Post, new { id = "TheForm" }))
                                                   { %>
                                                <%= Html.DropDownList("languageID", (SelectList)ViewData["LaguageList"], "Tất cả", new { onchange = "this.form.submit();" })%>
                                                <%= Html.Hidden("currentUrl" ,this.Request.RawUrl) %>
                                                <% } %>
                                            </div>
                                            <div><label>Các album mới nhất :</label>
                                             <% using (Html.BeginForm("ChangeAmountToShow", "Album", FormMethod.Post, new { id = "TheForm2" })){ %>
                                                <%=Html.DropDownList("amountList",null ,"tất cả", new { onchange = "this.form.submit();" })%>
                                             <% } %>
                                             </div>
                                        </div>
                                        <div>
                                            Kết quả <span id="startrecord"></span>-<span id="endrecord"></span> của <span id="totalrecords">
                                            </span>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.reset()">Thiết lập lại</a></div>
                                    </div>
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                        <tr>
                                            <th>
                                                <h3>Mã số</h3>
                                            </th>
                                            <th class="nosort">
                                                <h3>Ảnh chủ đề</h3>
                                            </th>
                                            <th>
                                                <h3>
                                                    Tiêu đề</h3>
                                            </th>
                                            <th>
                                                <h3>
                                                    Số hình</h3>
                                            </th>
                                            <th>
                                                <h3>
                                                    Người sửa cuối
                                                </h3>
                                            </th>
                                            <th>
                                                <h3>
                                                    Lần sửa cuối</h3>
                                            </th>


                                             <th class="nosort">
                                                <h3>
                                                    Xem nhanh</h3>
                                            </th>
                                            <th class="nosort">
                                                <h3>
                                                    Ẩn/Hiện</h3>
                                            </th>
                                            <th class="nosort">
                                                <h3>
                                                    Chi tiết</h3>
                                            </th>
                                            <th class="nosort">
                                                <h3>
                                                    Sửa</h3>
                                            </th>
                                            <th class="nosort">
                                                <h3>
                                                    Xóa</h3>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% foreach (var item in Model)
                                           { %>
                                        <tr>
                                            <td style="width: 50px; text-align: center;">
                                                <%= Html.Encode(item.AlbumID) %>
                                            </td>
                                            <td style="width: 50px; text-align: center;">
                                                <img src="../../../Image/Album/album-<%= item.AlbumID%>/<%= item.AlbumPhoto %>" alt="<%= item.AlbumPhoto %>" class="img70x70"/>
                                            </td>
                                            <td style="text-align: center;">
                                                  <%= Html.Encode(item.AlbumTitle)%>
                                            </td>
                                            <td style="width: 60px; text-align: center;">
                                                <%= Html.Encode(item.TotalImage.ToString() == "" ? "0" : item.TotalImage.ToString() )%>
                                            </td>
                                            <td style="text-align: center;">
                                                <%= Html.Encode(item.FullName) %>
                                            </td>
                                            <td style="width: 90px; text-align: center;">
                                                <%= Html.Encode(String.Format(IntroduceCompany.Util.ConstantClass._dateTimeFormat, item.AlbumDate))%>
                                            </td>

                                            <td style="width: 70px; text-align: center;">
                                              <% if (item.AlbumVisible)
                                                   {%>
                                                    <a href="<%= Url.Action("Frontend_AlbumDetails2", "Album", new  { albumID = item.AlbumID, languageID = item.LanguageID })%>"
                                                    target="_blank"><img src="../../../Content/Backend/js/table/images/grid_preview.png" alt="Xem nhanh" title="Xem nhanh"/></a>
                                                <%} %>
                                                 
                                            </td>
                                            <td style="width: 50px; text-align: center">
                                                <%if (item.AlbumVisible)
                                                  {%>
                                                <a href="<%= Url.Action("ChangeAlbumVisible","Album", new { albumID = item.AlbumID, albumVisible = item.AlbumVisible }) %>">
                                                    <img src="../../../Content/Backend/js/table/images/activation.png" alt="Hiện" title="Hiện" /></a>
                                                <%}
                                                  else
                                                  {%>
                                                <a href="<%= Url.Action("ChangeAlbumVisible","Album", new { albumID = item.AlbumID, albumVisible = item.AlbumVisible }) %>">
                                                    <img src="../../../Content/Backend/js/table/images/inactivation.png" alt="Ẩn" title="Ẩn" /></a>
                                                <%} %>
                                            </td>
                                            <td style="width: 50px; text-align: center">
                                                <a href="<%= Url.Action("AlbumDetail","Album",new { albumID = item.AlbumID, languageID = item.LanguageID}) %>">
                                                    <img src="../../../Content/Backend/js/table/images/grid_album.gif" alt="Chi tiết" title="Chi tiết Album" /></a>
                                            </td>
                                            <td style="width: 50px; text-align: center">
                                                <a href="<%= Url.Action("Edit","Album", new { albumID = item.AlbumID, languageID = item.LanguageID }) %>">
                                                    <img src="../../../Content/Backend/js/table/images/grid_edit.png" alt="Chỉnh sửa" title="Chỉnh sửa thông tin Album" /></a>
                                            </td>
                                            <td style="width: 50px; text-align: center">
                                                <a href="<%= Url.Action("AlbumDelete","Album",new { albumID = item.AlbumID}) %>"
                                                    onclick="javascript: if (confirm('Bạn muốn xóa bài viết này tin này?')) { window.location.href='#' } else { return false; };">
                                                    <img src="../../../Content/Backend/js/table/images/delete.png" alt="Xóa" title="Xóa Album" /></a>
                                            </td>
                                        </tr>
                                        <% } %>
                                    </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img alt="" src="../../../Content/Backend/js/table/images/first.gif" />
                                            <img src="../../../Content/Backend/js/table/images/first.gif" width="16" height="16"
                                                alt="First Page" onclick="sorter.move(-1,true)" />
                                            <img src="../../../Content/Backend/js/table/images/previous.gif" width="16" height="16"
                                                alt="First Page" onclick="sorter.move(-1)" />
                                            <img src="../../../Content/Backend/js/table/images/next.gif" width="16" height="16"
                                                alt="First Page" onclick="sorter.move(1)" />
                                            <img src="../../../Content/Backend/js/table/images/last.gif" width="16" height="16"
                                                alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown">
                                            </select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">Xem tất cả</a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="5">5</option>
                                                <option value="10" selected="selected">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                            </select>
                                            <span>Kết quả mỗi trang</span>
                                        </div>
                                        <div class="page">
                                            Trang <span id="currentpage"></span>của <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="../../../Content/Backend/js/table/5.js"></script>
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 10,
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    sortcolumn: 0,
                                    sortdir: -1,
                                    /* sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <!-- End one column tab content window -->
</asp:Content>
